package com.maserb.monitor.repository.schoolStudent;

import com.maserb.monitor.entity.card.RechargeRecordEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 充值记录
 */
@Repository
public interface RechargeRecordRepository extends JpaSpecificationExecutor<RechargeRecordEntity>
        , PagingAndSortingRepository<RechargeRecordEntity, String> {

    @Query(value = "from RechargeRecordEntity where student.id=?1")
    List<RechargeRecordEntity> findAllByStudentId(String studentId);

    @Query(value = "from RechargeRecordEntity where payStatus='1' and rechargeStatus is null and cardNumber is not null and cardNumber!=''")
    List<RechargeRecordEntity> findUnSend();
}